\(\int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx\) [56]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 125 \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {a^2 \tan (c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}+\frac {\left (2 a^2+b^2\right ) \tan ^3(c+d x)}{3 d}+\frac {a b \tan ^4(c+d x)}{d}+\frac {\left (a^2+2 b^2\right ) \tan ^5(c+d x)}{5 d}+\frac {a b \tan ^6(c+d x)}{3 d}+\frac {b^2 \tan ^7(c+d x)}{7 d} \]

[Out]

a^2*tan(d*x+c)/d+a*b*tan(d*x+c)^2/d+1/3*(2*a^2+b^2)*tan(d*x+c)^3/d+a*b*tan(d*x+c)^4/d+1/5*(a^2+2*b^2)*tan(d*x+
c)^5/d+1/3*a*b*tan(d*x+c)^6/d+1/7*b^2*tan(d*x+c)^7/d

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.071, Rules used = {3167, 962} \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {\left (a^2+2 b^2\right ) \tan ^5(c+d x)}{5 d}+\frac {\left (2 a^2+b^2\right ) \tan ^3(c+d x)}{3 d}+\frac {a^2 \tan (c+d x)}{d}+\frac {a b \tan ^6(c+d x)}{3 d}+\frac {a b \tan ^4(c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}+\frac {b^2 \tan ^7(c+d x)}{7 d} \]

[In]

Int[Sec[c + d*x]^8*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

(a^2*Tan[c + d*x])/d + (a*b*Tan[c + d*x]^2)/d + ((2*a^2 + b^2)*Tan[c + d*x]^3)/(3*d) + (a*b*Tan[c + d*x]^4)/d
+ ((a^2 + 2*b^2)*Tan[c + d*x]^5)/(5*d) + (a*b*Tan[c + d*x]^6)/(3*d) + (b^2*Tan[c + d*x]^7)/(7*d)

Rule 962

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIn
tegrand[(d + e*x)^m*(f + g*x)^n*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] &&
NeQ[c*d^2 + a*e^2, 0] && IGtQ[p, 0] && (IGtQ[m, 0] || (EqQ[m, -2] && EqQ[p, 1] && EqQ[d, 0]))

Rule 3167

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> Dist[-d^(-1), Subst[Int[x^m*((b + a*x)^n/(1 + x^2)^((m + n + 2)/2)), x], x, Cot[c + d*x]], x] /; FreeQ[
{a, b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[n, 0] && GtQ[m, 1])

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {(b+a x)^2 \left (1+x^2\right )^2}{x^8} \, dx,x,\cot (c+d x)\right )}{d} \\ & = -\frac {\text {Subst}\left (\int \left (\frac {b^2}{x^8}+\frac {2 a b}{x^7}+\frac {a^2+2 b^2}{x^6}+\frac {4 a b}{x^5}+\frac {2 a^2+b^2}{x^4}+\frac {2 a b}{x^3}+\frac {a^2}{x^2}\right ) \, dx,x,\cot (c+d x)\right )}{d} \\ & = \frac {a^2 \tan (c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}+\frac {\left (2 a^2+b^2\right ) \tan ^3(c+d x)}{3 d}+\frac {a b \tan ^4(c+d x)}{d}+\frac {\left (a^2+2 b^2\right ) \tan ^5(c+d x)}{5 d}+\frac {a b \tan ^6(c+d x)}{3 d}+\frac {b^2 \tan ^7(c+d x)}{7 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.72 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.83 \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {\tan (c+d x) \left (105 a^2+105 a b \tan (c+d x)+35 \left (2 a^2+b^2\right ) \tan ^2(c+d x)+105 a b \tan ^3(c+d x)+21 \left (a^2+2 b^2\right ) \tan ^4(c+d x)+35 a b \tan ^5(c+d x)+15 b^2 \tan ^6(c+d x)\right )}{105 d} \]

[In]

Integrate[Sec[c + d*x]^8*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

(Tan[c + d*x]*(105*a^2 + 105*a*b*Tan[c + d*x] + 35*(2*a^2 + b^2)*Tan[c + d*x]^2 + 105*a*b*Tan[c + d*x]^3 + 21*
(a^2 + 2*b^2)*Tan[c + d*x]^4 + 35*a*b*Tan[c + d*x]^5 + 15*b^2*Tan[c + d*x]^6))/(105*d)

Maple [A] (verified)

Time = 1.24 (sec) , antiderivative size = 110, normalized size of antiderivative = 0.88

method result size
derivativedivides \(\frac {-a^{2} \left (-\frac {8}{15}-\frac {\sec \left (d x +c \right )^{4}}{5}-\frac {4 \sec \left (d x +c \right )^{2}}{15}\right ) \tan \left (d x +c \right )+\frac {a b}{3 \cos \left (d x +c \right )^{6}}+b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{7 \cos \left (d x +c \right )^{7}}+\frac {4 \sin \left (d x +c \right )^{3}}{35 \cos \left (d x +c \right )^{5}}+\frac {8 \sin \left (d x +c \right )^{3}}{105 \cos \left (d x +c \right )^{3}}\right )}{d}\) \(110\)
default \(\frac {-a^{2} \left (-\frac {8}{15}-\frac {\sec \left (d x +c \right )^{4}}{5}-\frac {4 \sec \left (d x +c \right )^{2}}{15}\right ) \tan \left (d x +c \right )+\frac {a b}{3 \cos \left (d x +c \right )^{6}}+b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{7 \cos \left (d x +c \right )^{7}}+\frac {4 \sin \left (d x +c \right )^{3}}{35 \cos \left (d x +c \right )^{5}}+\frac {8 \sin \left (d x +c \right )^{3}}{105 \cos \left (d x +c \right )^{3}}\right )}{d}\) \(110\)
parts \(-\frac {a^{2} \left (-\frac {8}{15}-\frac {\sec \left (d x +c \right )^{4}}{5}-\frac {4 \sec \left (d x +c \right )^{2}}{15}\right ) \tan \left (d x +c \right )}{d}+\frac {b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{7 \cos \left (d x +c \right )^{7}}+\frac {4 \sin \left (d x +c \right )^{3}}{35 \cos \left (d x +c \right )^{5}}+\frac {8 \sin \left (d x +c \right )^{3}}{105 \cos \left (d x +c \right )^{3}}\right )}{d}+\frac {a b \sec \left (d x +c \right )^{6}}{3 d}\) \(115\)
risch \(\frac {16 i \left (-140 i a b \,{\mathrm e}^{8 i \left (d x +c \right )}+70 a^{2} {\mathrm e}^{8 i \left (d x +c \right )}-70 b^{2} {\mathrm e}^{8 i \left (d x +c \right )}-140 i a b \,{\mathrm e}^{6 i \left (d x +c \right )}+175 a^{2} {\mathrm e}^{6 i \left (d x +c \right )}+35 b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+147 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-21 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+49 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-7 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+7 a^{2}-b^{2}\right )}{105 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{7}}\) \(171\)
parallelrisch \(-\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (105 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{12}-210 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{11} a b -350 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10} a^{2}+140 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10} b^{2}+210 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9} a b +791 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8} a^{2}+112 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8} b^{2}-700 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7} a b -1092 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6} a^{2}+456 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6} b^{2}+700 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5} a b +791 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} a^{2}+112 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} b^{2}-210 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} a b -350 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a^{2}+140 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b^{2}+210 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a b +105 a^{2}\right )}{105 d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{7}}\) \(300\)

[In]

int(sec(d*x+c)^8*(cos(d*x+c)*a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(-a^2*(-8/15-1/5*sec(d*x+c)^4-4/15*sec(d*x+c)^2)*tan(d*x+c)+1/3*a*b/cos(d*x+c)^6+b^2*(1/7*sin(d*x+c)^3/cos
(d*x+c)^7+4/35*sin(d*x+c)^3/cos(d*x+c)^5+8/105*sin(d*x+c)^3/cos(d*x+c)^3))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.80 \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {35 \, a b \cos \left (d x + c\right ) + {\left (8 \, {\left (7 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{6} + 4 \, {\left (7 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{4} + 3 \, {\left (7 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 15 \, b^{2}\right )} \sin \left (d x + c\right )}{105 \, d \cos \left (d x + c\right )^{7}} \]

[In]

integrate(sec(d*x+c)^8*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

1/105*(35*a*b*cos(d*x + c) + (8*(7*a^2 - b^2)*cos(d*x + c)^6 + 4*(7*a^2 - b^2)*cos(d*x + c)^4 + 3*(7*a^2 - b^2
)*cos(d*x + c)^2 + 15*b^2)*sin(d*x + c))/(d*cos(d*x + c)^7)

Sympy [F(-1)]

Timed out. \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\text {Timed out} \]

[In]

integrate(sec(d*x+c)**8*(a*cos(d*x+c)+b*sin(d*x+c))**2,x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 91, normalized size of antiderivative = 0.73 \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {7 \, {\left (3 \, \tan \left (d x + c\right )^{5} + 10 \, \tan \left (d x + c\right )^{3} + 15 \, \tan \left (d x + c\right )\right )} a^{2} + {\left (15 \, \tan \left (d x + c\right )^{7} + 42 \, \tan \left (d x + c\right )^{5} + 35 \, \tan \left (d x + c\right )^{3}\right )} b^{2} - \frac {35 \, a b}{{\left (\sin \left (d x + c\right )^{2} - 1\right )}^{3}}}{105 \, d} \]

[In]

integrate(sec(d*x+c)^8*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

1/105*(7*(3*tan(d*x + c)^5 + 10*tan(d*x + c)^3 + 15*tan(d*x + c))*a^2 + (15*tan(d*x + c)^7 + 42*tan(d*x + c)^5
 + 35*tan(d*x + c)^3)*b^2 - 35*a*b/(sin(d*x + c)^2 - 1)^3)/d

Giac [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 118, normalized size of antiderivative = 0.94 \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {15 \, b^{2} \tan \left (d x + c\right )^{7} + 35 \, a b \tan \left (d x + c\right )^{6} + 21 \, a^{2} \tan \left (d x + c\right )^{5} + 42 \, b^{2} \tan \left (d x + c\right )^{5} + 105 \, a b \tan \left (d x + c\right )^{4} + 70 \, a^{2} \tan \left (d x + c\right )^{3} + 35 \, b^{2} \tan \left (d x + c\right )^{3} + 105 \, a b \tan \left (d x + c\right )^{2} + 105 \, a^{2} \tan \left (d x + c\right )}{105 \, d} \]

[In]

integrate(sec(d*x+c)^8*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/105*(15*b^2*tan(d*x + c)^7 + 35*a*b*tan(d*x + c)^6 + 21*a^2*tan(d*x + c)^5 + 42*b^2*tan(d*x + c)^5 + 105*a*b
*tan(d*x + c)^4 + 70*a^2*tan(d*x + c)^3 + 35*b^2*tan(d*x + c)^3 + 105*a*b*tan(d*x + c)^2 + 105*a^2*tan(d*x + c
))/d

Mupad [B] (verification not implemented)

Time = 22.70 (sec) , antiderivative size = 130, normalized size of antiderivative = 1.04 \[ \int \sec ^8(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {\frac {b^2\,\sin \left (c+d\,x\right )}{7}+{\cos \left (c+d\,x\right )}^2\,\left (\frac {a^2\,\sin \left (c+d\,x\right )}{5}-\frac {b^2\,\sin \left (c+d\,x\right )}{35}\right )+{\cos \left (c+d\,x\right )}^4\,\left (\frac {4\,a^2\,\sin \left (c+d\,x\right )}{15}-\frac {4\,b^2\,\sin \left (c+d\,x\right )}{105}\right )+{\cos \left (c+d\,x\right )}^6\,\left (\frac {8\,a^2\,\sin \left (c+d\,x\right )}{15}-\frac {8\,b^2\,\sin \left (c+d\,x\right )}{105}\right )+\frac {a\,b\,\cos \left (c+d\,x\right )}{3}}{d\,{\cos \left (c+d\,x\right )}^7} \]

[In]

int((a*cos(c + d*x) + b*sin(c + d*x))^2/cos(c + d*x)^8,x)

[Out]

((b^2*sin(c + d*x))/7 + cos(c + d*x)^2*((a^2*sin(c + d*x))/5 - (b^2*sin(c + d*x))/35) + cos(c + d*x)^4*((4*a^2
*sin(c + d*x))/15 - (4*b^2*sin(c + d*x))/105) + cos(c + d*x)^6*((8*a^2*sin(c + d*x))/15 - (8*b^2*sin(c + d*x))
/105) + (a*b*cos(c + d*x))/3)/(d*cos(c + d*x)^7)